// pages/home/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    userInfo: {
      name: "Andy",
      desc: "已和豌豆一起成长100天",
      shixun: "今日任务 还未 完成",
      score: 3
    },
    toolItems: [
      { id: 1, name: "我的订单", icon: "../../images/icon_pingkong@3x.png" },
      { id: 2, name: "我的代办", icon: "../../images/icon_pingkong_1@3x.png" },
      { id: 3, name: "体验预约", icon: "../../images/icon_pingkong_3@3x.png" }
    ],
    trainItems: [ 
      {
        trainId: 122,
        url: "../../images/train_icon_1@3x.png",
        name: "金牌月嫂特训营",
        feature: "免费月嫂体验/讲师面对面/一对一指导",
        playNum: 188
      },
      {
        trainId: 122,
        url: "../../images/train_icon_2@3x.png",
        name: "金牌月嫂特训营",
        feature: "免费月嫂体验/讲师面对面/一对一指导",
        playNum: 188
      }
    ],
    trainTotal: 22
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  onCheckMerchantHomeAction: function () {
    const storeName = "静安一店"
    wx.navigateTo({
      url: "../merchanthome/index?storeName=" + storeName,
    })
  },
  onClickToolItemAction: function (ev) {
    const item = ev.currentTarget.dataset.item;
    if (item.id === 1) {
      wx.switchTab({
        url: "../../pages/order/index",
      })
    } else if (item.id === 2) {
      wx.navigateTo({
        url: "../../pages/yuesao/index",
      })
    } else {
      wx.navigateTo({
        url: "../../pages/experience/index"
      })
    } 
    
  },
  onCheckItemDetailAction: function (ev) {
    
  },
  onCheckAllVideo : function (ev) {

  }
})